Shader "Unlit/Circle"
{

    Properties
    {
        _Color ("Color", Color) = (1,1,1,1)
        _CircleRange("CircleRange",Float) = 1.0
        _MainTex("MainTex",2D) = "white"{}
    }
    SubShader
    {
        Tags
        {
            "RenderType"="Opaque"
        }
        LOD 100

        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag

            #include "UnityCG.cginc"

            fixed4 _Color;
            float _Radius; // 用于控制圆的半径

            sampler2D _MainTex;
            float4 _MainTex_ST;

            float _CircleRange;

            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
                float4 positon : TEXCOORD1;
            };

            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = TRANSFORM_TEX(v.uv, _MainTex);
                o.positon = v.vertex;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            {
                half inCircle = 1 - step(_CircleRange, length(i.positon.xy));

                clip(-(inCircle - 0.1));

                return fixed4(_Color.rgb, 1);
            }
            ENDCG
        }
    }
    FallBack "Diffuse"
}